﻿<%@ Page Language="c#" Inherits="Discuz.Web.Admin.userreport_grid" Codebehind="global_userreport_grid.aspx.cs" %>
<%@ Register TagPrefix="cc1" Namespace="Discuz.Control" Assembly="Discuz.Control" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>用户列表</title>
<link href="../styles/datagrid.css" type="text/css" rel="stylesheet" />
<link href="../styles/calendar.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/common.js"></script>
<link href="../styles/dntmanager.css" type="text/css" rel="stylesheet" />
<link href="../styles/modelpopup.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/modalpopup.js"></script>
<script language="JavaScript" type="text/javascript" src="../../javascript/ajax.js"></script>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
</head>
<body>
<form id="Form1" method="post" runat="server">
<div class="ManagerForm">
<fieldset>
<legend style="background: url(../images/icons/icon32.jpg) no-repeat 6px 50%;">搜索用户</legend>
<asp:Panel ID="searchtable" runat="server" Visible="true">
<script type="text/javascript">
    var corp = '<%=Corpid.ClientID %>';
    var dept = '<%=Deptid.ClientID %>';
    var deptId = '<%=deptIdHidden.ClientID %>';
    var corpId = '<%=corpIdHidden.ClientID %>';
	function TYCorpDropBind(result){
	    if(result=="0"){
            alert("在调用WebService时发生错误，获取数据失败");
            return;
        }
        var aData = eval('('+result+')');
        var s = document.getElementById(corp);
        SelectBind(s,aData);
   
    }
    function TYDeptDropBind(result){
        if(result=="0"){
            alert("在调用WebService时发生错误，获取数据失败");
            return;
        }
        var aData = eval('('+result+')');
        var s = document.getElementById(dept);
        SelectBind(s,aData);
        
    }
    function SelectBind(s,aData){
        for(i=0;i<aData.length;i++){
           var option = document.createElement("option");
           option.appendChild(document.createTextNode(aData[i].name));
           option.value = aData[i].id;
           s.appendChild(option);          
        }      
   }
   function OnCorpSelected(){
       var s = document.getElementById(corp);
       var id = document.getElementById(corpId);
       id.value = s.value;
   }
   function OnDeptSelected(){
       var s = document.getElementById(dept);
       var id = document.getElementById(deptId);
       id.value = s.value;
   }
    
    
    window.onload = function(){
         var usercode = '<%=m_LoginUser_TYUserCode %>';
         _sendRequest("../../../services/getBoCorpJSON.aspx?User="+usercode+"&i="+Math.random(), TYCorpDropBind, false, '');
         _sendRequest("../../../services/getBoDeptJSON.aspx?User="+usercode+"&i="+Math.random(), TYDeptDropBind, false, '');         
    }
</script>
<table width="100%">
    <tr><td class="item_title" colspan="2">查询时间段</td></tr>
	<tr>
		<td class="vtop rowform" colspan="2">
			从&nbsp;<cc1:Calendar ID="joindateStart" runat="server" ReadOnly="False" ScriptPath="../js/calendar.js"> </cc1:Calendar>
            到&nbsp;<cc1:Calendar ID="joindateEnd" runat="server" ReadOnly="False" ScriptPath="../js/calendar.js"></cc1:Calendar>&nbsp;
            使用日期查找<input id="ispostdatetime" type="checkbox" value="1" name="cins" runat="server" />
		</td>
	</tr>
	<tr><td class="item_title">会员归属公司</td><td class="item_title">会员归属部门</td></tr>
    <tr>
		<td class="vtop rowform">
			<cc1:DropDownList id="Corpid" runat="server" IsMustBeSelected="true" width="220px"></cc1:DropDownList>
			<asp:HiddenField ID="corpIdHidden" runat="server" />
		</td>
		<td class="vtop rowform">
			<cc1:DropDownList id="Deptid" runat="server"  width="220px"></cc1:DropDownList>
			<asp:HiddenField ID="deptIdHidden" runat="server" />
		</td>
	</tr>
</table>
<div class="Navbutton"> <cc1:Button ID="Search" runat="server" Text="开始搜索"></cc1:Button></div>
</asp:Panel>
<cc1:Button ID="ResetSearchTable" runat="server" Text="重设搜索条件" Visible="False"></cc1:Button>
</fieldset>
</div>
<table width="100%">
<tr>
<td>
<cc1:DataGrid ID="DataGrid1" runat="server" OnPageIndexChanged="DataGrid_PageIndexChanged" align="center">
<Columns>
	<asp:BoundColumn DataField="uid" HeaderText="用户ID" Visible="false"></asp:BoundColumn>
	<asp:BoundColumn DataField="TY_CorpName" HeaderText="公司"></asp:BoundColumn>
	<asp:BoundColumn DataField="TY_DeptName" HeaderText="部门"></asp:BoundColumn>
	<asp:BoundColumn DataField="realName" HeaderText="姓名"></asp:BoundColumn>
	<asp:TemplateColumn HeaderText="登录名(工号)">
		<ItemTemplate>
			<a href="../../userinfo-<%# DataBinder.Eval(Container, "DataItem.uid")%>.aspx" target="_blank"><%# DataBinder.Eval(Container, "DataItem.username")%></a>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="总帖数">
		<ItemTemplate>
			<a href="../../search.aspx?type=allposts&searchsubmit=1&posterid=<%# DataBinder.Eval(Container, "DataItem.uid")%>&starttime=<%=StartTime %>&endtime=<%=EndTime %>" target="_blank"><%# DataBinder.Eval(Container, "DataItem.posts")%></a>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="精华帖数">
		<ItemTemplate>
			<a href="../../search.aspx?type=digest&searchsubmit=1&posterid=<%# DataBinder.Eval(Container, "DataItem.uid")%>&starttime=<%=StartTime %>&endtime=<%=EndTime %>" target="_blank"><%# DataBinder.Eval(Container, "DataItem.digestposts")%></a>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="置顶帖数">
		<ItemTemplate>
			<a href="../../search.aspx?type=topposts&searchsubmit=1&posterid=<%# DataBinder.Eval(Container, "DataItem.uid")%>&starttime=<%=StartTime %>&endtime=<%=EndTime %>" target="_blank"><%# DataBinder.Eval(Container, "DataItem.topposts")%></a>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="回复帖数">
		<ItemTemplate>
			<a href="../../search.aspx?type=reviews&searchsubmit=1&posterid=<%# DataBinder.Eval(Container, "DataItem.uid")%>&starttime=<%=StartTime %>&endtime=<%=EndTime %>" target="_blank"><%# DataBinder.Eval(Container, "DataItem.reviews")%></a>
		</ItemTemplate>
	</asp:TemplateColumn>
</Columns>
</cc1:DataGrid>
</td>
</tr>
</table>
</form>
<%=footer%>
</body>
</html>